package cate.game.role.pvp.throne.msg;

import cate.common.table.d.GDFunc;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTB;
import cate.game.play.part.PlaySide;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "同步淘汰赛阵容 の 请求")
public class SyncKoPositionReq implements MsgInput {

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<PlaySide> r = game.fight.side.createPlaySideByRole(cc.getRole(), GDFunc.GRADE_PVP);
        if (!r.ok()) {
            return;
        }
        if (!game.pvp.throne.data.holder.allowChangeKoPs(cc.getRole())) {
            //game.notice.message(cc.getRole(), "当前无法修改布阵");
            return;
        }
        game.pvp.throne.message.syncKoPosition(r.data);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTB.SYNC_KO_POSITION_REQ;
    }
}
